using System;
using System.Collections.Generic;
using System.Text;

namespace NBox.Service.Communication
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class ServiceMessageSummary
    {
        /// <summary>
        /// 
        /// </summary>
        public string ServiceName;
        /// <summary>
        /// 
        /// </summary>
        public string MethodSignature;
        /// <summary>
        /// 
        /// </summary>
        public Guid TransactionId;
        /// <summary>
        /// 
        /// </summary>
        public DateTime Expiration;
        /// <summary>
        /// 
        /// </summary>
        public Guid MessageId = Guid.NewGuid();
        /// <summary>
        /// 
        /// </summary>
        public byte Priority = 10;
        /// <summary>
        /// 
        /// </summary>
        public DateTime Timestamp = DateTime.Now;
        /// <summary>
        /// 
        /// </summary>
        public bool IsOneWay = false;
        /// <summary>
        /// 
        /// </summary>
        public bool IsRequestMessae = false;

        /// <summary>
        /// 
        /// </summary>
        protected ServiceMessageSummary() { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="methodSignature"></param>
        /// <param name="transactionId"></param>
        /// <param name="expiration"></param>
        /// <param name="isRequestMessage"></param>
        /// <param name="isOneWay"></param>
        protected ServiceMessageSummary(string serviceName, string methodSignature, 
            Guid transactionId, DateTime expiration, bool isRequestMessage, bool isOneWay)
        {
            this.ServiceName = serviceName;
            this.MethodSignature = methodSignature;
            this.TransactionId = transactionId;
            this.Expiration = expiration;
            this.IsRequestMessae = isRequestMessage;
            this.IsOneWay = isOneWay;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class ServiceMessage : ServiceMessageSummary
    {
        /// <summary>
        /// 
        /// </summary>
        public ParameterCollection MethodParameters = new ParameterCollection();
        /// <summary>
        /// 
        /// </summary>
        public string CompressedParameters;
        /// <summary>
        /// 
        /// </summary>
        public string MethodReturnData;

        /// <summary>
        /// 
        /// </summary>
        public ServiceMessage() : base()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="methodSignature"></param>
        /// <param name="transactionId"></param>
        /// <param name="expiration"></param>
        /// <param name="isRequestMessage"></param>
        /// <param name="isOneWay"></param>
        public ServiceMessage(string serviceName, string methodSignature,
            Guid transactionId, DateTime expiration, bool isRequestMessage, bool isOneWay)
            : base(serviceName, methodSignature, transactionId, expiration, isRequestMessage, isOneWay)
        {
        }
    }
}
